tibasicfandomcom-20200215-history
TI-Basic 89 Programming
This page is designed to give someone with no programming experience an insight into the TI-89's version of TI-Basic which is called: "TIGCC" For other versions of TI-BASIC, See TI-Basic Programming. Introduction Purpose The purpose of this section of the TI-Basic Wikibook is to explore the capabilities of the TI-89 series (TI-89/Titanium, TI-92/+, Voyage 200) with the built-in interpreter. It is recommended to read through the guide from the beginning in order to build a strong understanding of the language and its applications. This section is devoted entirely to the Motorola 68k version of TI-Basic, which is more powerful than the Z80 version. For information on TI-Basic for the Z80 series, return to TI-Basic Programming and select the TI-84 version. Overview TI-Basic is a simple interpreted language used on Texas Instruments graphing calculators, which can be used to rapidly automate equations or algorithms. However, as an interpreted language, it is generally not fast enough for a game, so for anything requiring fast processing, assembly language is required. This is, however, outside the scope of this Wikibook. Even though the language is slow, for most purposes it will serve admirably. Differences between Versions of TI-Basic *The version of TI-Basic for the 83-type calculators (73 Explorer, 83/+/SE, 84/+/SE) is less powerful, and also less integrated into the calculator itself. However, it is still powerful enough to automate most functions. *The version for the 89-series (89/Titanium, 92/+, Voyage 200), is more powerful and more heavily integrated into the calculator. For this section of the TI-Basic Wikibook, this is the version that will be focused upon. Output :How to display words, numbers and more to the user Disp is a command which will display a number, string, equation or other type of variable/literal given as arguments. Disp can accept an unlimited number of arguments seperated by commas (although it recommended to keep the number of arguments under 7 because after seven, for each consecutive argument the screen pushes everything else up passed the top of the screen, even the seventh pushes the first line up a slight amount), and will display each argument following the previous line. Syntax: Disp Disp 5+7 Ex: Display Lines Assuming you have stored the value 5 into x (via 5→x) and a blank I/O screen and you executed this program, you would have the following on your I/O screen: Ex: Empty Lines Ex: Truncated Pause displays an argument, then pauses execution afterwards. Syntax: Pause Ex: Hello Ex: Pause Output allows the display of an argument in a location other than the next line. The item to be displayed is outputted to the specified coordinates supplied to the function. It is useful for formatted display. Syntax: Output Ex: Basic Ex: Too Long Return displays an argument on the home screen, or just returns to the home screen if no argument is supplied. Syntax: Return Ex: Return Let's say you stored the value 5 in x (using 5→x) before executing the function. For the sake that this can only be used in a function, the appropriate tags and a name are supplied for this example. Input :How to receive words, numbers and more from the user is a command which will display a string and wait for the user to input a value. The value will then be stored into the specified variable once ENTER is pressed. The behavior of this command changes depending on how many parameters are passed into it, explained below. Syntax: Input Ex: With String Ex. Without String Ex: Without Arguments InputStr is much like input, but the values inputted into this command will always be a string (so no quotation marks are needed). Syntax: InputStr Ex: InputStr Prompt prompts the user to input a number of variables. While this can be used to input more than one variable with one command, it does not give you the flexibility to change what is displayed on screen. Syntax: Prompt Example: Prompt Request puts a pop-up box on the current screen and allows the user to input a string into it, and then stores that string into a variable. Request can be used as a stand-alone command or as part of a Dialog block (more on those later). Syntax: Request Ex: Request PopUp displays a pop up window with a number of choices for the user to choose between (passed in as a list). Then, the number of the choice the user selects will be stored into the variable given. Syntax: PopUp Example: Correct Equation DropDown displays a pop up window with (a) pull down menu(s) with a number of choices for the user to choose between (passed in as a list). Then, the number of the choice the user selects will be stored into the variable given. The DropDown command must be used in a block. Placing multiple DropDown''s will not return multiple pop up windows but will put all menus in the same window. ''DropDown can be paired with other dialog options such as Request or Title Syntax: DropDown Example: Correct Equation The Title will appear in the top of the pop up window Passing in Arguments Passing in arguments is vital to functions, and can be helpful in programs as well. In order to get an argument to be passed in, it must be declared in the opening parenthesis of the program editor. Then, when calling the program (by typing prgmname() in the home screen), you put the declared arguments into the parenthesis, like so: prgmname(arg). Note: for all of the following examples, the name of the function is "temp" (and it is a function). Syntax Example: Temp Let's say you call this program like so: temp(12,4,52). The following will appear on your home screen: Custom Tool Bars It is possible to create your own personal toolbar at the top of your TI-89 where you can place whatever programs and/or functions that you want for easy access. To create a tool bar, you must create a block. Each tab is a and each item within the tab is an . Syntax Example Conditional Functions :Learn about controlling the flow of a program using conditionals such as If If is a command which will determine whether or not the next line of code is executed. Syntax: If Ex: If Category:TI-Basic 89 Programing Category:TI-Basic Wikibook Category:Reference Category:TI-Basic Programming